Skip to main content

Version Control

Version control is a system that tracks changes in documents, enabling easy recovery of older versions and collaboration among users.

Git

  • License: GNU General Public License
  • Type: Distributed Version Control System (VCS)
  • Usage: Tracks changes not only in code but also in documents and images.

Advantages of Git

  • Enables multiple users to have a copy of the code and synchronize changes.
  • It's one of the most commonly used version control systems.

GitHub and Alternatives

  • GitHub: A widely-used service for hosting Git repositories.
  • Alternatives: GitLab, BitBucket, Beanstalk offer similar functionalities.

Basic Git Concepts

  • SSH Protocol: A secure method for remote login.
  • Repository: A project folder under version control.
  • Fork: A copy of a repository.
  • Pull Request: A method for submitting changes for review.
  • Working Directory: Local files associated with a Git repository.

Essential Git Commands

  • git init: Initialize a new Git repository.
  • git add: Stage changes for commit.
  • git status: Display the status of changes.
  • git commit: Commit changes to the repository.
  • git reset: Revert changes in the staging area or working directory.
  • git log: View a log of previous changes.
  • git branch: Create or manage branches.
  • git checkout: Switch between branches.
  • git merge: Combine changes from different branches.

Learning Resources

  • GitHub Learning: Accessible at try.github.io, provides cheat sheets and tutorials for Git.

Creating a Repository

Components

  • Repository: A data structure to store documents with version-control capabilities.
  • Organization: A group of user accounts owning repositories, with administrative owners.

Steps to Create a Repository

  1. Choose to create a new repository or take the Introduction to GitHub course after signing up.
  2. A repository typically includes:
    • README file: Describes the project's purpose.
    • License: Specifies how the code can be used.
  3. Repositories can be private or public.

Repository Tabs

  • Code: Contains all the source files.
  • Issues: Manages tasks and bugs.
  • Pull Requests: Reviews and discusses changes.
  • Projects: Organizes project work.
  • Wiki, Security, Insights: Provides additional tools for advanced users.
  • Settings: Customizes repository settings.

Creating a GitHub Account

Before utilizing these instructions, register and log in to your GitHub account.

Creating a New Repository

  1. Navigate and select New Repository from the + menu.
  2. Fill in details like the repository name and description.
  3. Choose the repository's visibility.
  4. Opt to initialize the repository with a README file.
  5. Create the repository.

Managing Repository Content

  • Editing ReadMe.md:
    1. Use the online editor.
    2. Commit changes after editing.
  • Creating a New File:
    1. Name and provide details for the file.
    2. Enter the code and commit changes.
  • Editing an Existing File:
    1. Make changes and commit.
  • Uploading Files:
    1. Upload files from your local system and commit changes.